// pages/orther/orther.js
var network = require("../../utils/network.js");
Page({

  /**
   * 页面的初始数据
   */
  data: {
    list: [],
    QRcode: ['http://admin-tbyl.moqilin.net/goods/20170831/e6798a5bd033de5d7ced99d216746b47.jpg']
  },

  /***
   获取列表
  */
  getList: function () {
    let that = this;
    let page = 0;
    let pagesize = 100;
    let URL = network.server() + 'cloud-dynamic/list';
    let Params = { page: page, pagesize: pagesize};
    let Method = 'GET';
    let Message = '';
    network.requestLoading(URL, Params, Method, Message, function (res) {
      console.log('血栓无忧---',res)
      if (res.code == 0 ){
        page++;
        let list = res.data.list;
        that.setData({
          list: list,
        })
      }
    }, function () {
      wx.showToast({
        title: '加载数据失败',
      })
    })
  },
  previewImage: function(e){
    let that = this;
    let current = e.target.dataset.src;  
    wx.previewImage({
      current: current, 
      urls: that.data.QRcode 
    })
  },

  /*详情页*/
  detail: function (e) {
    //let index = parseInt(e.currentTarget.dataset.index);
    //let id = this.data.list[index].id;
    let id = parseInt(e.currentTarget.dataset.id);
    
    console.log(id)
    wx.navigateTo({
      url: '../ortherDetail/detail?id=' + id,
    })
  },
  /***
   * 
   * 页面加载
  */
  onLoad: function (Options){
    
  },
  onShow: function (){
    this.getList();
  },
  onShareAppMessage: function () { }
})